﻿/*-------------------------------------------------------------------------
* 命名空间: SiliconSelect.Common/RandomHelper
* 类       名: RandomHelper
* 功      能:  获取随机数的帮助类
* 时      间:  2023/7/21 11:12:17
* 版      本:  V1.0
* 作      者:  Fioman
* 格      言:  Talk is cheap,show me the code ^_^
*-------------------------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace SiliconSelect.Common
{
    public class RandomHelper
    {
        /// <summary>
        /// 获取区间字符串例如这种"2,3", "4,5"
        /// </summary>
        /// <param name="start"></param>
        /// <param name="end"></param>
        public static string GetRandomIntString(int start = 0, int end = 10)
        {
            Random random = new Random();
            int first = random.Next(start, end);
            int second = random.Next(start, end);
            if (first <= second)
            {
                return $"{first},{second}";
            }
            else
            {
                return $"{second},{first}";
            }
        }

        /// <summary>
        /// 生成[start,end)之间的一个随机整数
        /// </summary>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <returns></returns>
        public static int GetRandomInt(int start = 0, int end = 10)
        {
            Random random = new Random();
            int number = random.Next(start, end);
            return number;
        }
    }
}
